{% extends "base.html" %}
{% load utils %}

{% block content %}
<div id="content-header">
<h2>查看交易</h2>
<div class="top-tools">
	<a href="..">返回帐户</a>
</div>
<div class="clear"></div>
</div>

<table class="trans">
<tr>
	<th class="col-trans">交易类型</th>
	{#<th class="col-usage">用途</th>#}
	<th class="col-account">账户</th>
	<th class="col-amount">金额</th>
	<th class="col-time">时间</th>
	<th class="col-action"></th>
</tr>
{% for tranc in transactions %}
<tr>
	<td class="col-trans"><a href="{{ tranc.id }}">{{ tranc|get_tranc_disp_name }}</a></td>
	{#<td class="col-usage">{{ tranc.usage }}</td>#}
	<td class="col-account">{{ tranc|disp_member_account }}</td>
	<td class="col-amount">{{ tranc.amount }}</td>
	<td class="col-time">{{ tranc.time|local_time|date:"Y年n月d G点i分" }}</td>
	<td class="col-action">
		<a class="delete-trans delete" href="{{ tranc.id }}/delete/">删除</a>
	</td>
</tr>
{% empty %}
<tr>
	<td colspan="100" class="empty">此帐户还未发生交易</td>
</tr>
{% endfor %}
</table>

<p id="account-total">账户总余额：{{ account.amount }}元，我的余额：{{ account|member_amount:request.user }}元</p>

<div class="bottom-tools">
	<a href="..">返回账户</a>
</div>
{% endblock %}

{% block embedded_javascript %}
(function($) {
	$(function() {
		$(".delete-trans").click(function() {
			if (confirm("确定要删除此交易吗？")) {
				return true;
			}
			return false;
		});
	});
})(jQuery)
{% endblock %}
